
<!--
 * @Author: cgl
 * @Date: 2023-04-18 15:12:26
 * @LastEditors: cgl
 * @LastEditTime: 2023-07-04 15:19:55
 * @FilePath: \public-health-emergencies-fed:\radiation-hygiene-fe\src\views\slide\components\basicTable.vue
 * @Description: 
 * 
 * Copyright (c) 2023 by cgl/微盛信息产业有限公司, All Rights Reserved. 
-->
<template>
	<div>
		<table style="width: 100%"  border="1" cellspacing="0" cellpadding="0" align="center">
			<tr>
				<td>设备参数</td>
				<td colspan="3">
					额定管电压：<el-input v-model="basicForm.basicInfo.maximumTubeVoltage" style="width: 100px"/>kV；
					额定管电流：<el-input v-model="basicForm.basicInfo.maximumTubeCurrent" style="width: 100px"/>mA；
					管球数：<el-input v-model="basicForm.basicInfo.tubularBulbNumber" style="width: 100px"/>个；
					接收器：<el-input v-model="basicForm.basicInfo.receiverNumber" style="width: 100px"/>个；
				</td>
			</tr>
			
			<tr>
				<td>控制器模式</td>
				<td>
					<el-radio-group v-model="basicForm.basicInfo.controllerMode">
						<el-radio :label="0">AEC</el-radio>
						<el-radio :label="1" >手动模式</el-radio>
					</el-radio-group>
				</td>
				<td>限束器</td>
				<td>
					<el-radio-group v-model="basicForm.basicInfo.haveBeamLimitingDevice">
						<el-radio :label="true">有</el-radio>
						<el-radio :label="false">无</el-radio>
					</el-radio-group>
				</td>
			</tr>

			<tr>
				<td>靶/滤过</td>
				<td colspan="3">
					<el-checkbox-group style="display: inline-block;" v-model="targetFiltrationType" @change="handleTargetFiltrationTypeChange">
						<el-checkbox label="0">Mo/Mo</el-checkbox>
						<el-checkbox label="1">Mo/Rh</el-checkbox>
						<el-checkbox label="2">Rh/Al</el-checkbox>
						<el-checkbox label="3">Rh/Rh</el-checkbox>
						<el-checkbox label="4">W/Ag</el-checkbox>
						<el-checkbox label="5">其他</el-checkbox>
					</el-checkbox-group>
					<el-select
						v-model="basicForm.basicInfo.cus_otherTarget"
						size="mini"
						placeholder=""
						style="width: 60px; margin-left: 15px;"
						class="splitselect"
						:disabled="!targetFiltrationType.includes('5')"
						clearable>
						<el-option
							v-for="item in dict.type.target_type"
							:key="item.value"
							:label="item.label"
							:value="item.label">
						</el-option>
					</el-select> /
					<el-select
						v-model="basicForm.basicInfo.cus_otherfiltration"
						size="mini"
						placeholder=""
						style="width: 60px"
						class="splitselect"
						:disabled="!targetFiltrationType.includes('5')"
						clearable>
						<el-option
							v-for="item in dict.type.filtration_type"
							:key="item.value"
							:label="item.label"
							:value="item.label">
						</el-option>
					</el-select>
				</td>
			</tr>

			<tr>
				<td width="10%">设备使用信息</td>
				<td width="40%" colspan="3">
					临床常用焦点：
					<el-select
						v-model="basicForm.basicInfo.clinicalCommonFocus"
						size="mini"
						placeholder=""
						style="width: 80px"
						class="splitselect"
						clearable>
						<el-option label="大焦点" value="大焦点"></el-option>
						<el-option label="小焦点" value="小焦点"></el-option>
					</el-select>
					临床常用靶/过滤：
					<el-select
						v-model="basicForm.basicInfo.clinicalCommonTarget"
						size="mini"
						placeholder=""
						style="width: 60px"
						class="splitselect"
						clearable>
						<el-option
							v-for="item in dict.type.target_type"
							:key="item.value"
							:label="item.label"
							:value="item.label">
						</el-option>
					</el-select> /
					<el-select
						v-model="basicForm.basicInfo.clinicalCommonFiltration"
						size="mini"
						placeholder=""
						style="width: 60px"
						class="splitselect"
						clearable>
						<el-option
							v-for="item in dict.type.filtration_type"
							:key="item.value"
							:label="item.label"
							:value="item.label">
						</el-option>
					</el-select>；
					<br/>
					<br/>
					年工作量=<el-input v-model="basicForm.basicInfo.unitSecondOfZhang" style="width: 100px;"/>
					s/张×<el-input v-model="basicForm.basicInfo.unitZhangOfYear" style="width: 100px"/>
					张/年÷3600=<el-input v-model="basicForm.basicInfo.unitHourOfYear" style="width: 100px"/>
					h/年
				</td>
			</tr>
		</table>
	</div>
</template>

<script>

export default {
  name: "basicTable12",
	dicts: ['target_type', 'filtration_type'],
  data() {
    return {
			form: {},
			targetFiltrationType: [],
    };
  },
  props: {
		// 基本信息数据
    basicForm: {
			type: Object,
      default: () => {
				return {}
			},
    },
		// 状态
    lrstatus: {
			type: String,
      default: "",
    },
  },
	created() {
		console.log('基本情况(12)', this.basicForm)
	},
	inject: {
    app: { value: "app", default: null }
	},
  watch: {
    'app.dialogVisibleEquipment': {
      handler(val) {
				if(val) {
					let arr = this.basicForm.basicInfo.otherType?.split("/") || [];
					if(arr[0]) {
						this.$set(this.basicForm.basicInfo, "cus_otherTarget", arr[0]);
					}
					if(arr[1]) {
						this.$set(this.basicForm.basicInfo, "cus_otherfiltration", arr[1]);
					}

					this.targetFiltrationType = this.basicForm.basicInfo.targetFiltrationType?.split(',') || []
					if (!this.basicForm.basicInfo.cus_otherTarget || this.basicForm.basicInfo.cus_otherTarget == 'undefined') {
						this.basicForm.basicInfo.cus_otherTarget = ''
					}
					if (!this.basicForm.basicInfo.cus_otherfiltration || this.basicForm.basicInfo.cus_otherfiltration == 'undefined') {
						this.basicForm.basicInfo.cus_otherfiltration = ''
					}
				}
      },
      deep: true,
      immediate: true
    },
		'basicForm.basicInfo': {
			deep: true,
			handler(val) {
				if (this.basicForm.basicInfo.unitSecondOfZhang && this.basicForm.basicInfo.unitZhangOfYear) {
					this.basicForm.basicInfo.unitHourOfYear = (this.basicForm.basicInfo.unitSecondOfZhang * this.basicForm.basicInfo.unitZhangOfYear / 3600).toFixed(2)
				}
			},
		}
  },
	methods: {
		handleTargetFiltrationTypeChange(value) {
			if (!value) this.basicForm.basicInfo.targetFiltrationType = ''
			else this.basicForm.basicInfo.targetFiltrationType = value.join(',')
		}
	}
};
</script>

<style lang="scss" scoped>
@import '../content.scss';
</style>